﻿using System;

namespace negoserverjni
{
    public class InsideAsyncResult : IAsyncResult
    {
        object asyncstate;
        bool completedsynchronously;
        bool completed;
        public object AsyncState
        {
            get { return asyncstate; }
            internal set { asyncstate = value; }
        }

        public System.Threading.WaitHandle AsyncWaitHandle
        {
            get { throw new NotImplementedException(); }
        }

        public bool CompletedSynchronously
        {
            get { return completedsynchronously; }
            internal set { completedsynchronously = value; }
        }

        public bool IsCompleted
        {
            get { return completed; }
            internal set { completed = value; }
        }
        public static InsideAsyncResult Async(object state)
        {
            InsideAsyncResult iar  = new InsideAsyncResult();
            iar.asyncstate = state;
            return iar;
        }
        public static InsideAsyncResult Synchronous(object state)
        {
            InsideAsyncResult iar = new InsideAsyncResult();
            iar.asyncstate = state;
            iar.completed = true;
            iar.completedsynchronously = true;
            return iar;
        }
    }
}
